package com.shuangfeidasan.service.ums.impl;

import com.shuangfeidasan.model.ums.UmsAdminRoleRelation;
import com.shuangfeidasan.mapper.ums.UmsAdminRoleRelationMapper;
import com.shuangfeidasan.service.ums.UmsAdminRoleRelationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description 后台用户和角色关系表(UmsAdminRoleRelation)表服务实现类
 * @Author JunWEI
 * @Date 2022-02-28 14:30:34
 */
@Service("umsAdminRoleRelationService")
public class UmsAdminRoleRelationServiceImpl implements UmsAdminRoleRelationService {
    @Resource
    private UmsAdminRoleRelationMapper umsAdminRoleRelationMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public UmsAdminRoleRelation queryById(Long id) {
        return this.umsAdminRoleRelationMapper.queryById(id);
    }

    /**
     * 查询指定行
     *
     * @param umsAdminRoleRelation 筛选条件
     * @return 查询结果
     */
    @Override
    public List<UmsAdminRoleRelation> queryAll(UmsAdminRoleRelation umsAdminRoleRelation) {
        return this.umsAdminRoleRelationMapper.queryAll(umsAdminRoleRelation);
    }

    /**
     * 新增数据
     *
     * @param umsAdminRoleRelation 实例对象
     * @return 实例对象
     */
    @Override
    public UmsAdminRoleRelation insert(UmsAdminRoleRelation umsAdminRoleRelation) {
        this.umsAdminRoleRelationMapper.insert(umsAdminRoleRelation);
        return umsAdminRoleRelation;
    }

    /**
     * 修改数据
     *
     * @param umsAdminRoleRelation 实例对象
     * @return 实例对象
     */
    @Override
    public UmsAdminRoleRelation update(UmsAdminRoleRelation umsAdminRoleRelation) {
        this.umsAdminRoleRelationMapper.update(umsAdminRoleRelation);
        return this.queryById(umsAdminRoleRelation.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.umsAdminRoleRelationMapper.deleteById(id) > 0;
    }
}
